package cn.com.sise.service.impl;

import cn.com.sise.dao.UserDao;
import cn.com.sise.pojo.Dictionary;
import cn.com.sise.pojo.Resources;
import cn.com.sise.pojo.User;
import cn.com.sise.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    private UserDao userDao;

    @Autowired
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public User login(String name, String password) {
        return userDao.login(name, password);
    }

    public User getUserByName(String name) {
        return userDao.getUserByName(name);
    }

    public List<User> getList(int start, int count) {
        return userDao.getList(start, count);
    }

    public Integer getTotal() {
        return userDao.getTotal();
    }

    public List<User> getListLike(String nameLike, int start, int count) {
        List<User> userList = new ArrayList<User>();
        userList = userDao.getListLike(nameLike, start, count);
        return userList;
    }

    public int getLikeTotal(String likeTotalName) {
        return userDao.getLikeTotal(likeTotalName);
    }

    public int insertUser(User user) {
        return userDao.insertUser(user);
    }

    public int deleteUser(User user) {
        return userDao.deleteUser(user);
    }

    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    public User selectUserById(User user) {
        return userDao.selectUserById(user);
    }

    public List<User> selectAllUser() {
        return userDao.selectAllUser();
    }

    public int getTimeForUser(String time) {
        return userDao.getTimeForUser(time);
    }

    public List<User> getHistoryDictionaryByUserId(int userId) {
        return userDao.getHistoryDictionaryByUserId(userId);
    }

    public List<User> getFavoritesDictionaryByUserId(int userId) {
        return userDao.getFavoritesDictionaryByUserId(userId);
    }

    public List<User> getHistoryResourcesByUserId(int userId) {
        return userDao.getHistoryResourcesByUserId(userId);
    }

    public List<User> getFavoritesResourcesByUserId(int userId) {
        return userDao.getFavoritesResourcesByUserId(userId);
    }
}
